import { Navigate, Route, Routes } from 'react-router-dom';
import { routes } from "./routers";
import './App.scss'

function App() {
    return (
        <div className="App">
            {/* 册路由 */}
            <Routes>
                {
                    routes.map(route => (
                    <Route key={route.path} path={route.path} element={<route.element />}></Route>
                    ))
                }
                {/* 跳转路由不存在时默认跳转页面 */}
                <Route path="*" element={<Navigate to="/index" />} />
            </Routes>
        </div>
    )
}

export default App